<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
    <style>
        .account {
            width: 400px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div class="account">
    <h1 style="text-align: center;">注册</h1>
    <form action="" method="post">
    {% csrf_token %}
        {% for field in form %}
            {% if field.name == 'code' %}
                <div class="form-group">
                    <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                    <div class="clearfix">
                        <div class="c1 col-md-6" style="padding-left: 0;">{{ field }}</div>
                        <div class="col-md-6"><input type="button" class="btn btn-default" id="get_code" value="点击获取验证码"></div>
                    </div>

                </div>
            {% else %}
                <div class="form-group">
                    <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                    {{ field }}
                </div>
            {% endif %}
        {% endfor %}
        <span>{{ form_obj.errors }}</span>
        <button type="submit" class="btn btn-primary">注 册</button>
    </form>


</div>
<script src="/static/jquery-3.3.1.min.js"></script>
<script>    
    $('#get_code').on("click",function () {
        $.ajax({
            url:'/send/sms/?tpl=register',
            type:'GET',
            data:{
                'k1':$('.c1').val(),
            },
            success:function (ret) {

            }
        })
    })
</script>
</body>
</html>